package find.chat.test;

import java.io.UnsupportedEncodingException;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.Instrumentation;
import android.app.Instrumentation.ActivityMonitor;
import android.content.Intent;
import android.location.LocationManager;
import android.os.Handler;
import android.test.suitebuilder.annotation.SmallTest;
import find.chat.*;
import find.chat.R;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.Toast;
import android.test.TouchUtils;
import android.test.ActivityInstrumentationTestCase2;

public class gps extends ActivityInstrumentationTestCase2<GPSActivity> {
	private GPSActivity mActivity;
	Button button1;
	public gps() {
		super(GPSActivity.class);
	}

	protected void setUp() throws Exception {
		// this method is called every time before any test execution
		super.setUp();

		mActivity = (GPSActivity) getActivity();
		button1 = (Button) mActivity.findViewById(find.chat.R.id.button1);// get current activity
		// link the objects with the activity objects
	}

	@SmallTest
	// SmallTest: this test doesn't interact with any file system or network.
	public void testView() { // checks if the activity is created
		assertNotNull(getActivity());
	}

	public void testingShortClick2() {
		if (!mActivity.manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
			Button buttonToClick = mActivity.gps
					.getButton(AlertDialog.BUTTON_POSITIVE);
			TouchUtils.clickView(this, buttonToClick);
			assertTrue(buttonToClick.performClick());
		}
	}
	public void testingShortClick() {
		if (!mActivity.manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
			Button button3= mActivity.gps
					.getButton(AlertDialog.BUTTON_NEGATIVE);
			TouchUtils.clickView(this, button3);
			assertTrue(button3.performClick());
			TouchUtils.clickView(this, button1);
		}
	}
}
